feat(swap-widget): broadcast api-supplied approval txs - #12518
Conversation
|
Warning Review limit reached
Next review available in: 21 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c91b5d5 to
3196dbb
Compare
c7fa6f9 to
8f9d84f
Compare
3196dbb to
86b1f6a
Compare
Use quote.approval.approvalTxs (sequential broadcast, wait for each receipt) instead of hand-encoding a single approve. Inherits the API's USDT-style reset handling - the previous single approve reverted on-chain for tokens requiring a zero-allowance reset whenever a prior exact approval was left unspent. Local encoding remains as fallback for API versions predating approvalTxs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
86b1f6a to
53eb27d
Compare
….7.0 The machine only enters approving when the api set isRequired, which contractually implies non-empty approvalTxs - the local encode fallback was unreachable on current api versions and silently reproduced the legacy exact-approve behavior (no USDT reset) against stale ones. Replace it with an explicit error. Throw when an approval receipt reverts: in the reset-then-approve flow an unchecked reverted reset would cascade into a second guaranteed revert and a false APPROVAL_SUCCESS. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…heck Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Description
Follow-up to #12517 (stacked on it) — the widget now consumes the API's
approval.approvalTxsinstead of hand-encoding a single approve.useSwapApprovalbroadcasts the supplied transactions sequentially, waiting for each receipt, and reports the final hash to the machine. This inherits the API's USDT-style reset handling and fixes a latent on-chain revert: the previous singleapprove(spender, amount)fails for reset-requiring tokens whenever a prior exact approval was left unspent (e.g. the widget's own approve-then-abandon flow leaves a dangling non-zero USDT allowance, breaking the next larger sell through the same spender).Local exact-approve encoding remains as a fallback for API deployments predating
approvalTxs, so widget and API can release in either order.Issue (if applicable)
closes #
Risk
Low. Approval flow only; the common case (no reset needed) broadcasts the same single exact-amount approve as before, now server-encoded. Swap execution untouched.
Widget ERC-20 approval transactions on EVM sells. Same spender, same exact amount; USDT-style tokens gain the required
approve(spender, 0)reset first.Testing
Engineering
approvalTxsshapes (single exact approve, USDT reset pair, no false-positive reset on USDC, empty when approved) were E2E-verified against live mainnet state in feat(public-api): approval txs on quote, allowance contract on rates #12517.Operations
Screenshots (if applicable)
🤖 Generated with Claude Code